(function () {
    "use strict";

    angular.module('core').factory('vendaVarejoService', factory);
    factory.$inject = ['$http', '$q'];

    function factory($http, $q) {

        return {
            get: function (id) {
                 
            var deferred = $q.defer();
            $http.post('/vendavarejo/get', id)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            getAll: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/getall', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            count: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/count', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },

            save: function (item) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/save', item)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            delete: function (id) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/delete', id)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },

            getAllItem: function (args) {
                var deferred = $q.defer();
                $http.post('/vendavarejo/getallitem', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            countItem: function (args) {
                var deferred = $q.defer();
                $http.post('/vendavarejo/countitem', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            getAllPagamento: function (args) {
                var deferred = $q.defer();
                $http.post('/vendavarejo/getAllPagamento', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            prepareNewPagamento: function (args) {
                var deferred = $q.defer();
                $http.post('/vendavarejo/preparenewpagamento', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            chartEvolucaoVenda: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartEvolucaoVenda', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            chartEvolucaoVendaAcumulada: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartEvolucaoVendaAcumulada', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            chartGrupo: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartGrupo', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            chartSubgrupo: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartSubgrupo', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            chartTipo: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartTipo', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            chartColecao: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartColecao', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            chartLinha: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartLinha', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            chartMarca: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/chartMarca', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },

            getSumario: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/getSumario', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },

            getDesempenhoLoja: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/getDesempenhoLoja', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            getDesempenhoVendedor: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/getDesempenhoVendedor', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },
            getDesempenhoProduto: function (args) {
            var deferred = $q.defer();
            $http.post('/vendavarejo/getDesempenhoProduto', args)
                .success(function (data) { deferred.resolve(data); })
                .error(function (data, status, headers, config) { deferred.reject(data); });
            return deferred.promise;
        },

            generateFinanceiro: function (args) {
                var deferred = $q.defer();
                $http.post('/vendavarejo/generateFinanceiro', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },

            groupAllConferenciaMovimento: function (args) {
                var deferred = $q.defer();
                $http.post('/vendavarejo/groupAllConferenciaMovimento', args)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            },
            GetVendaPagamentoSemFinanceiro: function (id) {
                var deferred = $q.defer();
                $http.post('/vendavarejo/GetVendaPagamentoSemFinanceiro', id)
                    .success(function (data) { deferred.resolve(data); })
                    .error(function (data, status, headers, config) { deferred.reject(data); });
                return deferred.promise;
            }

        };
    }

})();


